package com.example.aerospacemanagementsystem.controller.logistics;

import com.example.aerospacemanagementsystem.entity.logistics.Usage;
import com.example.aerospacemanagementsystem.entity.logistics.Vehicle;
import com.example.aerospacemanagementsystem.service.logisticsService.impl.UsageService;
import com.example.aerospacemanagementsystem.service.logisticsService.impl.VehicleService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
/**
 * @author 李铭
 */

@Api(tags = "车辆")
@RestController
@CrossOrigin
@RequestMapping("/vehicle")
public class VehicleController {
    @Autowired
    private VehicleService vehicleService;

    @PostMapping
    public int add(@RequestBody Vehicle vehicle){
        return vehicleService.add(vehicle);
    }

    @DeleteMapping
    public int delete(Vehicle vehicle){
        return vehicleService.delete(vehicle);
    }

    @PutMapping
    public int update(@RequestBody Vehicle vehicle){
        return vehicleService.update(vehicle);
    }

    @GetMapping("/getAll")
    public List<Vehicle> getAllCity(Vehicle vehicle) {
        List<Vehicle> list = vehicleService.getAllVehicle(vehicle);
        return list;
    }
}
